package com.homelock.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.homelock.service.LockUserBindService;
import com.pi.base.dto.result.AppResult;
import com.pi.http.base.controller.BaseController;

@RequestMapping("/lock")
@RestController
public class LockBindingController extends BaseController {

    @Autowired
    private LockUserBindService lockUserBindService;
    
    @RequestMapping("/bind/state")
    public AppResult hasUnboundLock() {
        return AppResult.newSuccessResult(lockUserBindService.hasUnboundLock(getLoginUserId()));
    }

    @RequestMapping("/bind")
    public AppResult bindLockUser() {
        lockUserBindService.bindLockUser(getLoginUserId());
        return AppResult.OK;
    }
}
